home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6892 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: andrew.cmu.edu!bo24+
  2. From: Berend Ozceri <bo24+@andrew.cmu.edu>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Messages vs. Semaphores for external clocking
  5. Date: Thu,  4 Apr 1996 15:38:38 -0500
  6. Organization: Masters student, Electrical and Computer Engineering, Carnegie Mellon, Pittsburgh, PA
  7. Distribution: world
  8. Message-ID: <slN3BCS00iWZ0_8G1R@andrew.cmu.edu>
  9. References: <4ju349$r1e@sparky.navsea.navy.mil>
  10.     <4jvrqs$hk0@btmpjg.god.bel.alcatel.be>
  11. NNTP-Posting-Host: po2.andrew.cmu.edu
  12. In-Reply-To: <4jvrqs$hk0@btmpjg.god.bel.alcatel.be>
  13.  
  14. Excerpts from netnews.comp.sys.amiga.programmer: 4-Apr-96 Re: Messages
  15. vs. Semaphores.. by @nlev00 
  16. > >I am wondering what is the most efficient way for one task to make data
  17. > >available to another task.  I can do this by passing messages, or by
  18. > >setting up a semaphore to provide a common area of memory accessible by
  19. > >both tasks.
  20. > >
  21. > [..description removed..]
  22. >  
  23. > Use global data, which your subtask fills with the timer-values,
  24. > and the parent process reads. Disable() and Enable() multitasking
  25. > when performing such a critical action (reading or writing from the
  26. > global data). No message port or semaphore needed.
  27.  
  28. This is very, very bad advice. A message port or a semaphore is indeed
  29. needed. Disable()/Enable() are bad programming styles, especially for
  30. user level programs because they disable multitasking. Using semaphores
  31. to protect critical sections is a much better solution. As a matter of
  32. fact, this is exactly the type of situation semaphores are there for.
  33.  
  34. Berend Ozceri
  35. Carnegie Mellon University
  36.  
  37.